//
//  CharCollectionCell.swift
//  skylowApp
//
//  Created by 漫云 on 2024/9/20.
//

import UIKit

class CharCollectionCell: UICollectionViewCell {

    @IBOutlet weak var headImgview: UIImageView!
    
    @IBOutlet weak var hotView: UIView!
    
    @IBOutlet weak var hotLabel: UILabel!
    
    @IBOutlet weak var titleLabel: UILabel!
    
    @IBOutlet weak var cententLabel: UILabel!
    
    @IBOutlet weak var chatButton: UIButton!
    
    
    override func awakeFromNib() {
       
        super.awakeFromNib()
        // Initialization code
        
        let gradientLayer = CAGradientLayer()
        gradientLayer.frame = chatButton.bounds
        gradientLayer.colors = [UIColor(red: 0.70, green: 0.27, blue: 0.57, alpha: 1.00).cgColor, UIColor(red: 0.95, green: 0.37, blue: 0.47, alpha: 1.00).cgColor] // 渐变色
        gradientLayer.locations = [0.0, 1.0] // 渐变点
        gradientLayer.startPoint = CGPoint(x: 0.0, y: 0.5) // 起始点
        gradientLayer.endPoint = CGPoint(x: 1.0, y: 0.5) // 结束点

        // 将渐变层添加到按钮图层并设置为背景
        chatButton.layer.insertSublayer(gradientLayer, at: 0)

        chatButton.addRoundedCorners(withRadius: 4)
        headImgview.addRoundedCorners(withRadius: headImgview.height/2, byRoundingCorners: [.topLeft,.topRight])
        hotView.addRoundedCorners(withRadius: 20, byRoundingCorners: [.bottomRight,.topRight])
        
        titleLabel.font = .boldSystemFont(ofSize: 14)
        cententLabel.font = .regular(12)
        hotLabel.font = .regular(12)
    }
}
